/*
 * $Id: qtcQPushButton.cpp 7 2010-11-07 09:07:07Z tfonrouge $
 */

#include "qtharbour.h"

#include <QWidget>
#include <QPushButton>
#include <QIcon>

HB_FUNC( QPUSHBUTTON_NEW )
{
    xho_ObjParams objParams = xho_ObjParams( NULL );
    
    QPointer<QPushButton> pushButton = NULL;
    
    QWidget* widget = (QWidget *) xho_par_XhoObject( 1, "QWidget" );
    
    if( widget || hb_pcount() == 0 )
    {
        pushButton = new QPushButton( widget );
    }
    else 
        if( HB_ISCHAR( 1 ) )
        {
            pushButton = new QPushButton( qth_parc( 1 ), (QWidget *) xho_par_XhoObject( 2 ) );
        }
        else
        {
            QIcon* icon = (QIcon *) xho_par_XhoObject( 1, "QIcon" );

            if( icon )
                pushButton = new QPushButton( *(QIcon *) icon, qth_parc( 2 ), (QWidget *) xho_par_XhoObject( 3 ) );
        }

    objParams.Return( pushButton );
}

/* <QTH_GEN> */
HB_FUNC( QPUSHBUTTON_AUTODEFAULT )
{
    QPushButton* pushButton = (QPushButton *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( pushButton )
    {
        hb_retl( pushButton->autoDefault() );
    }
}

HB_FUNC( QPUSHBUTTON_ISDEFAULT )
{
    QPushButton* pushButton = (QPushButton *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( pushButton )
    {
        hb_retl( pushButton->isDefault() );
    }
}

HB_FUNC( QPUSHBUTTON_ISFLAT )
{
    QPushButton* pushButton = (QPushButton *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( pushButton )
    {
        hb_retl( pushButton->isFlat() );
    }
}

HB_FUNC( QPUSHBUTTON_MENU )
{
    QPushButton* pushButton = (QPushButton *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( pushButton )
    {
        xho_itemReturn( (QObject *) pushButton->menu() );
    }
}

HB_FUNC( QPUSHBUTTON_SETAUTODEFAULT )
{
    QPushButton* pushButton = (QPushButton *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( pushButton )
    {
        pushButton->setAutoDefault( hb_parl( 1 ) );
    }
}

HB_FUNC( QPUSHBUTTON_SETDEFAULT )
{
    QPushButton* pushButton = (QPushButton *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( pushButton )
    {
        pushButton->setDefault( hb_parl( 1 ) );
    }
}

HB_FUNC( QPUSHBUTTON_SETFLAT )
{
    QPushButton* pushButton = (QPushButton *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( pushButton )
    {
        pushButton->setFlat( hb_parl( 1 ) );
    }
}

HB_FUNC( QPUSHBUTTON_SETMENU )
{
    QPushButton* pushButton = (QPushButton *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( pushButton )
    {
        pushButton->setMenu( (QMenu *) xho_par_XhoObject( 1 ) );
    }
}

/* </QTH_GEN> */
